#include	"DBProxyApp.h"
#include	"DBProxyService.h"
#include	<IniFile.h>

bool DBProxyApp::OnInit(Command & cmd) {
	IniFile conf;
	if (!conf.Load("./config.ini")) throw std::runtime_error("Missing config.ini");

	int log_level = conf.Get<int>("zone", "log_level", ELog::Info);
	Logger::Instance().Init("zone", "logs", 4194304, (ELog::Level)log_level);

	return DBProxyService::Instance().Initialize(conf);
}

void DBProxyApp::OnExit(int code) {
	LOG_INFO("Application dbproxy will exit : %d", code);
}

RUN_APP(DBProxyApp)